package edu.gatech.cs2340.group7.wheresmystuffapp.presenters;

import android.content.Intent;
import edu.gatech.cs2340.group7.wheresmystuffapp.model.Account;
import edu.gatech.cs2340.group7.wheresmystuffapp.model.DataManager;
import edu.gatech.cs2340.group7.wheresmystuffapp.views.AdminMainMenuView;
/**
 * This does all of the work for the Admin Main Menu
 * @author Sarah
 *
 */
public class AdminMainMenuPresenter {

	private AdminMainMenuView view;
	private final String PACKAGE_NAME;

	public AdminMainMenuPresenter(AdminMainMenuView v) {
		view = v;
		PACKAGE_NAME = view.getPackageName();
	}

	/**
	 * Takes the admin to a page where they can create a new admin
	 * @param intent
	 */
	public void createAdmin(Intent intent) {
		intent.setPackage(PACKAGE_NAME);
		view.startActivity(intent);

	}

	/**
	 * Takes the admin to a page where they can lock accounts
	 * @param intent
	 */
	public void lockAccount(Intent intent) {
		intent.setPackage(PACKAGE_NAME);
		view.startActivity(intent);

	}

	/**
	 * Takes the admin to a page where they can remove users
	 * @param intent
	 */
	public void removeUser(Intent intent) {
		intent.setPackage(PACKAGE_NAME);
		view.startActivity(intent);

	}

	/**
	 * Logs the admin out
	 * 
	 * @param intent
	 */
	public void logout(Intent intent) {
		intent.setPackage(PACKAGE_NAME);
		Account a = DataManager.getCurrentAccount();
		a.setLoginAttempts(0);
		DataManager.setCurrentAccount(null);
		view.startActivity(intent);
	}

	/**
	 * Takes the admin to a page where they can unlock accounts
	 * 
	 * @param intent
	 */
	public void unlockAccount(Intent intent) {
		intent.setPackage(PACKAGE_NAME);
		view.startActivity(intent);
	}

}
